<?php
/**
 * 
 */
class Sx_user extends CI_Controller {
	var $postAction;
	/*手机KEY*/
	var $postMobiKey;
	/*sessionID*/
	var $postSessionId;
	/*用户ID*/
	var $userID;
	
	public function index(){
		
		/*判断用户权限*/
		$this -> postMobiKey = $this -> input -> post('mobikey');
		$this -> postSessionId = $this -> input -> post('sessionid');
		$this -> userArr = $this -> sx_useropen_mod -> user_con($this -> postMobiKey, $this -> postSessionId, TRUE);
		if (!$this -> userArr) {
			/*session或者Key过期，验证失败*/
			print($this -> fengchaoclass -> showhckmsg("-1", NULL, $this -> lang -> line('hck_no'), TRUE));
			exit ;
		} 
		//获取action
		$this->postAction = $this->input->post("action");
		//取得当前用户ID
		$this -> userID = $this -> userArr['userid'];
		switch ($this->postAction) {
			/*显示个人信息*/
			case 'show':
				$this->getUser();
				break;
			/*编辑个人信息*/
			case 'edit':
				$this->setUser();
				break;
			/*返回个人发布的菜品*/
			case 'getArticle':
				
				break;
			/*返回个人发布的评论*/
			case 'getComment':
				 
				break;
			default:
				
				break;
		}
	}
	/**
	 * 返回个人信息
	 */
	private function getUser(){
		//获取userid
		$uid = $this->input->post("userid");		
		empty($uid)?$this->userID = $this -> userArr['userid']:$this->userID =$uid;
		if(!$this->sx_db_mod->get_user($this->userID)){
			print($this -> fengchaoclass -> showhckmsg("1", NULL, $this -> lang -> line('hck_no'), TRUE));
		}else{
			$rArr = array('Msg_error' => "0", 'Msg' => "返回用户信息", 'MsgTime' => date("Y-m-d H:i:s"));
			$rArr['Resource']  = $this->sx_db_mod->get_user($this->userID);
			print(json_encode($rArr));
		}
		
		
	}
	/**
	 * 修改个人信息
	 */
	private function setUser(){
		
	}
	
}

?>